package se.energimyndigheten.lampguiden.lighting;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ArrayAdapter;

import se.energimyndigheten.lampguiden.R;
import se.energimyndigheten.lampguiden.SubPageListActivity;
import se.energimyndigheten.lampguiden.info.InfoWebActivity;


public class LightingActivity extends SubPageListActivity implements OnItemClickListener {
    private static final String HELP_PATH = HTML_BASEPATH + "Help/sv_Lighting.html";
//    private static final String TAG = LightingActivity.class.getSimpleName();

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.info_activity); // Reuse
        String[] lighting = getResources().getStringArray(R.array.basta_ljuset);
        setListAdapter(new ArrayAdapter<String>(this, R.layout.lighting_listitem, R.id.listitem, lighting));
        getListView().setOnItemClickListener(this);
    }

    @Override
    protected void onResume() {
        mSelectedActivity = ACTIVITY_LIGHTING;
        super.showHelpActionItem(HELP_PATH);
        super.onResume();
    }

    @Override
    public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
        Intent intent = new Intent(this, InfoWebActivity.class);
        int pid=0;
        switch (position) {
        case 0:
            pid=R.string.best_general;
            break;
        case 4:
            pid=R.string.best_read;
            break;
        case 3:
            pid=R.string.best_dinner;
            break;
        case 1:
            pid=R.string.best_work;
            break;
        case 2:
            pid=R.string.best_bath;
            break;
//        case 5:
//            pid=R.string.best_cooking;
//            break;
        case 5:
            pid=R.string.best_dimmer;
            break;
        case 6:
            pid=R.string.best_mood;
            break;
        default:
            intent = null;
        }

        if (intent != null) {
            intent.putExtra(InfoWebActivity.EXTRA_TITLE, getString(pid));
            intent.putExtra(InfoWebActivity.EXTRA_VIEW, pid);
            intent.putExtra(InfoWebActivity.EXTRA_MENUSELECTION,ACTIVITY_LIGHTING );
            startActivity(intent);
        }
    }
}